﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using projet_fichier_objet;
using FichierTxt;
using Outils;
using System.Collections.Generic;
using System.Data.SqlClient;

namespace App_Recherche
{
    public partial class Suppression : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            //récupération de l'id de l'intérimaire à supprimer
            string id = Request.QueryString["id"];
            int ID =0;
            if(int.TryParse(id,out ID))
            {
                //string CnxInterimaire = "Data Source=PILOTT-LGZ;Initial Catalog=Interimaires;Integrated Security=True;Pooling=False";
                SqlConnection SqlC = new SqlConnection(Utils.CnxInterimaire);
                SqlC.Open();
                SqlCommand SqlCmd = SqlC.CreateCommand();
                SqlCmd.CommandText = "DELETE FROM Interimaire WHERE Id = " + ID + "";
                SqlDataReader SqlReader = SqlCmd.ExecuteReader();
                SqlC.Close();
                Response.Redirect("~/Page_aspx/Default.aspx?id=" + (int)Utils.TypePage.suppression);
            }
        }
    }
}
